//
//  ByFileManager.h
//  laserdevice_ios
//
//  Created by pro on 16/12/13.
//  Copyright © 2016年 com.itboye. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface ByFileManager : NSObject
#pragma mark - 通用
// 沙盒路径
+ (void)homePath;

// 创建文件夹
+ (BOOL)createDocument:(NSString *)ducName
               existed:(void (^)(void))existedBlock
               failure:(void (^)(NSError *error))failureBlock;

// 创建文件
+ (BOOL)createFile:(NSString *)fileName
              data:(NSData *)data
           existed:(void (^)(void))existedBlock;


// 移除文件或文件夹
+ (BOOL)removeDocumentOrFileWithPathName:(NSString *)pathName
                                 failure:(void (^)(NSError *error))failureBlock;


#pragma mark - 场景相关
// 保存为LD（我定义的文件类型）
+ (void)saveSceneWithName:(NSString *)sceneName
                  bgImage:(UIImage *)bgImage
              shapeImages:(NSArray *)shapeImages
                     json:(NSData *)jsonData
                  existed:(void (^)(void))existedBlock
                  failure:(void (^)(NSError *error))failureBlock;

// 保存为PDF
+ (void)saveSceneForPDFWithName:(NSString *)name
                          image:(UIImage *)image
                           size:(CGSize)size
                           json:(NSData *)jsonData;

+ (void)deleteSceneWithName:(NSString *)sceneName
                    success:(void (^)(void))successBlock
                    failure:(void (^)(NSError *error))failureBlock;


+ (NSArray *)allScenes;

+ (UIImage *)getImageAtScene:(NSString *)sceneName imagePath:(NSString *)imagePath;


#pragma mark - 数据导入
+ (void)saveHistoryWithName:(NSString *)name
                       json:(NSData *)jsonData
                    existed:(void (^)(void))existedBlock
                    failure:(void (^)(NSError *error))failureBlock;

+ (void)deleteHistoryWithName:(NSString *)name
                      success:(void (^)(void))successBlock
                      failure:(void (^)(NSError *error))failureBlock;

+ (NSArray *)allHistorys;

#pragma mark - 实时测量
// 保存为PDF
+ (void)saveMeastureForPDFWithName:(NSString *)name
                             image:(UIImage *)image
                              size:(CGSize)size
                              json:(NSData *)jsonData;

+ (void)deleteMeastureWithName:(NSString *)name
                       success:(void (^)(void))successBlock
                       failure:(void (^)(NSError *error))failureBlock;


+ (NSArray *)allMeastures;

+ (UIImage *)getImageAtMeasture:(NSString *)name imagePath:(NSString *)imagePath;
@end
